﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DepthViewer
{
    public class DepthProcessor
    {

        public double MIN_DISTANCE = 1000;
        public double MAX_DISTANCE = 1500;
       
        public double MAX_HEIGHT = 10;
        public double MIN_HEIGHT = 0;

        public double TOTAL_HEIGHT;
        public double TOTAL_DISTANCE;

        public DepthProcessor() {
            TOTAL_DISTANCE = MAX_DISTANCE - MIN_DISTANCE;
            TOTAL_HEIGHT = MAX_HEIGHT - MIN_HEIGHT;
        }


        public double getHeight(double distance) {
            if (distance < MIN_DISTANCE) return MIN_HEIGHT;
            if (distance > MAX_DISTANCE) return MAX_HEIGHT;
            if (distance != 0 && distance != -1)
            {
                return (((distance-MIN_DISTANCE)/TOTAL_DISTANCE)*TOTAL_HEIGHT)+MIN_HEIGHT;
            }
            else 
            {
                return MIN_HEIGHT;
            }

        } 
    }
}
